<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- 生产环境版本，优化了尺寸和速度 -->
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>

    <link
            rel="stylesheet"
            href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"
    />

    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <title>后台管理-登录</title>
    <link rel="stylesheet" href="/css/login.css" />
<!--    <script src="./js/ui-index.js"></script>-->
<!--    <script src="./js/vue.js"></script>-->
<!--    <link rel="stylesheet" href="./js/vue-index.css">-->
</head>
<body>
<div id="app">
    <div class="title">后台管理</div>
    <el-form
            :label-position="labelPosition"
            label-width="80px"
            :model="formLabelAlign"
    >
        <el-form-item label="账号">
            <el-input v-model="formLabelAlign.username"></el-input>
        </el-form-item>
        <el-form-item label="密码">
            <el-input show-password v-model="formLabelAlign.password"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button  type="primary" @click="submitForm()">登录</el-button>
            <el-button @click="resetForm()">重置</el-button>
        </el-form-item>
    </el-form>
</div>
</body>

<script>
    var app = new Vue({
        el: "#app",
        data: {
            message: "Hello Vue!",
            labelPosition: "right",
            formLabelAlign: {
                username: "",
                password: "",
            },
        },
        methods: {
            resetForm() {
                this.formLabelAlign.username = "";
                this.formLabelAlign.password = "";
            },
            submitForm() {
                if (
                    this.formLabelAlign.username === "admin" &&
                    this.formLabelAlign.password === "lww"
                ) {
                    window.location.href = "/back";
                }else {
                    this.$message({
                        showClose: true,
                        message: '登录失败，账号或者密码错误哦！',
                        type: 'error'
                    });
                }
            },
        },
    });
</script>
</html>
